#ifndef __OMODEL_CACHE_H__
#define __OMODEL_CACHE_H__

#include "misc/oXmlItemCache.h"

class oSpriteDef;
class oAnimationDef;
class oModelDef;
class oClipDef;
class oActionDef;
class oFrameActionDef;

class oDLL oModelCache: public oXmlItemCache<oModelDef>
{
public:
	SHARED_CACHE_FUNC(oModelCache)
protected:
	oModelCache(){}
	virtual void beforeParse( const char* filename );
	virtual void afterParse( const char* filename );
	virtual void textHandler( void *ctx, const char *s, int len );
	virtual void startElement( void *ctx, const char *name, const char **atts );
	virtual void endElement( void *ctx, const char *name );
	const static uint32 MAX_LOOKS;
private:
	oAnimationDef* getAnimationForFrame();
	stack<oSpriteDef*> _nodeStack;
	CCTexture2D* _pCurrentTex;
	oClipDef* _pCurrentClip;
	oActionDef* _pCurrentAction;
};

#define oSharedModelCache oModelCache::sharedCache()

#endif